﻿using System;
using System.Windows.Data;
using BizControl.Library.BusinessObjects.Marks;
using System.Windows;

namespace BizControl.Presentation.ActivityEditModule.Converters
{
  public class MarkStateToPathConverter : IValueConverter
  {
    #region IValueConverter Members

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      var state = (MarkState)Enum.Parse(typeof(MarkState), value.ToString());
      if (state.HasFlag(MarkState.Completed)) return Application.Current.FindResource("OkPath");
      if (state.HasFlag(MarkState.NotCompleted)) return Application.Current.FindResource("CancelPath");
      if (state.HasFlag(MarkState.Overdue)) return Application.Current.FindResource("CancelPath");
      return null;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      return null;
    }

    #endregion
  }
}
